"""
系统配置表 Schema
"""

from datetime import datetime
from typing import Optional

from pydantic import Field

from app.schemas.base import BaseSchema


class ConfigBase(BaseSchema):
    """系统配置表 基础模型"""

    config_name: str = Field(max_length=50, description="配置名称", alias="configName")
    config_key: str = Field(max_length=50, description="配置key", alias="configKey")
    config_value: str = Field(max_length=100, description="配置值", alias="configValue")
    remark: Optional[str] = Field(default=None, max_length=255, description="备注", alias="remark")


class ConfigCreate(ConfigBase):
    """创建系统配置表 模型"""

    pass


class ConfigUpdate(ConfigBase):
    """更新系统配置表 模型"""

    config_name: Optional[str] = Field(default=None, max_length=50, description="配置名称", alias="configName")
    config_key: Optional[str] = Field(default=None, max_length=50, description="配置key", alias="configKey")
    config_value: Optional[str] = Field(default=None, max_length=100, description="配置值", alias="configValue")
    remark: Optional[str] = Field(default=None, max_length=255, description="备注", alias="remark")


class ConfigPublic(ConfigBase):
    """系统配置表 公共模型，用于API响应"""

    id: int = Field(alias="id", description="主键")
    config_name: str = Field(alias="configName", max_length=50, description="配置名称")
    config_key: str = Field(alias="configKey", max_length=50, description="配置key")
    config_value: str = Field(alias="configValue", max_length=100, description="配置值")
    remark: Optional[str] = Field(default=None, alias="remark", max_length=255, description="备注")
    create_time: Optional[datetime] = Field(default=None, alias="createTime", description="创建时间")
    create_by: Optional[int] = Field(default=None, alias="createBy", description="创建人ID")
    update_time: Optional[datetime] = Field(default=None, alias="updateTime", description="更新时间")
    update_by: Optional[int] = Field(default=None, alias="updateBy", description="更新人ID")
